package com.stu.facade.base;

import java.beans.Transient;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;

import com.stu.utils.BeanUtils;

public class BaseFacade<T> implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private String uuid;
	private String createTime;
	
	public String getUuid() {
		return uuid;
	}
	public void setUuid(String uuid) {
		this.uuid = uuid;
	}
	public String getCreateTime() {
		return createTime;
	}
	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}
	
	/**
	 * 
	 * @param entity
	 * @throws InvocationTargetException 
	 * @throws IllegalAccessException 
	 */
	public void toFacade(T entity) throws IllegalAccessException, InvocationTargetException {
		BeanUtils.copyNotNullProperties(entity, this);
	}

	/**
	 * 将这个类里面的属性灌入entity类中
	 * 
	 * @param entity
	 *            需要赋值的实体类
	 * @throws InvocationTargetException 
	 * @throws IllegalAccessException 
	 */
	@Transient
	public void toEntity(T entity) throws IllegalAccessException, InvocationTargetException {
		BeanUtils.copyNotNullProperties(this, entity);
	}

}
